﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Data;
using DAL;
namespace logic
{
   public  class buyerFixedPricePeriodItem
    {
        public static DataTable rootCategorylistWithCompanyId(int companyId)
        {
            return DAL.BuyerFixedPricePeriodItem.rootCategorylistWithCompanyId(companyId);
        }

        public static DataTable subCategorylistWithCompanyId(int companyId, int category)
        {
            return DAL.BuyerFixedPricePeriodItem.subCategorylistWithCompanyId(companyId, category);
        }

        public static DataTable listWithCategoryAndCompany(int companyId, int categoryid)
        {
            return DAL.BuyerFixedPricePeriodItem.listWithCategoryAndCompany(companyId,categoryid);
        }
        public static void insert(BuyerFixedPricePeriodItemEntity _bfpEnt)
        {
            BuyerFixedPricePeriodItem.insert(_bfpEnt);
        }
        public static DataSet select(string where, string orderby, int pagesize, int pageindex)
        {
            return DAL.DbHelper.ExecuteDataSetPageSize("bpid, fpid, productId, proName, sellerId, sellerName, sellerPrice, price, inputDt, adminId, inputName", "[dbo].[vw_BuyerFixedPricePeriodItem_list]", where, "bpId", orderby, pagesize, pageindex);
        }

        public static DataTable HistoryPrice_subCategorylistWithCompanyId(int companyId, int category)
        {
            return DAL.BuyerFixedPricePeriodItem.HistoryPrice_subCategorylistWithCompanyId(companyId,category);
        }

        public static DataTable HistoryPrice_rootCategorylistWithCompanyId(int companyId)
        {
            return DAL.BuyerFixedPricePeriodItem.HistoryPrice_rootCategorylistWithCompanyId(companyId);
        }

        public static DataTable HistoryPrice_listWithCategoryAndCompany(int companyId, int categoryid)
        {
            return DAL.BuyerFixedPricePeriodItem.HistoryPrice_listWithCategoryAndCompany(companyId, categoryid);
        }

       /// <summary>
       /// 根据采购商ID和收货日期得到对应周期中的商品价格
       /// </summary>
       /// <param name="buyerId">采购商ID</param>
       /// <param name="receiveDt">收货日期</param>
       /// <returns></returns>
        public static DataTable listByBuyerIdAndReceiveDt(int buyerId, DateTime receiveDt)
        {
            return BuyerFixedPricePeriodItem.listByBuyerIdAndReceiveDt(buyerId, receiveDt);
        }

        public static BuyerFixedPricePeriodItemEntity getBybpId(int bpId)
        {
            return BuyerFixedPricePeriodItem.getBybpId(bpId);
        }
    }
}
